import reducer from '@/reducers/counter'
import { PLUS, MINUS } from '@/actions/counter'

export default (ctx) => {
  // console.log(ctx);
  const {
    plus,
    minus
  } = reducer(ctx.$data)

  return function(type, ...args){
    switch (type){
      case PLUS:
        ctx.result = plus(...args);
        console.log(arguments);
        break;
      case MINUS:
        ctx.result = minus(...args);
        break;
      default:
        break
    }
  }
}
